home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 21 / AACD 21.iso / AACD / Utilities / Ghostscript / src / ccfont.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-01-01  |  4.0 KB  |  105 lines

  1. /* Copyright (C) 1992, 1995, 1998, 1999 Aladdin Enterprises.  All rights reserved.
  2.   
  3.   This file is part of AFPL Ghostscript.
  4.   
  5.   AFPL Ghostscript is distributed with NO WARRANTY OF ANY KIND.  No author or
  6.   distributor accepts any responsibility for the consequences of using it, or
  7.   for whether it serves any particular purpose or works at all, unless he or
  8.   she says so in writing.  Refer to the Aladdin Free Public License (the
  9.   "License") for full details.
  10.   
  11.   Every copy of AFPL Ghostscript must include a copy of the License, normally
  12.   in a plain ASCII text file named PUBLIC.  The License grants you the right
  13.   to copy, modify and redistribute AFPL Ghostscript, but only under certain
  14.   conditions described in the License.  Among other things, the License
  15.   requires that the copyright notice and this notice be preserved on all
  16.   copies.
  17. */
  18.  
  19. /*$Id: ccfont.h,v 1.2 2000/09/19 19:00:09 lpd Exp $ */
  20. /* Header for fonts compiled into C. */
  21.  
  22. #ifndef ccfont_INCLUDED
  23. #  define ccfont_INCLUDED
  24.  
  25. /* Include all the things a compiled font needs. */
  26. #include "stdpre.h"
  27. #include "gsmemory.h"
  28. #include "iref.h"
  29. #include "ivmspace.h"        /* for avm_foreign */
  30. #include "store.h"
  31.  
  32. /* Define type-specific refs for initializing arrays. */
  33. #define ref_(t) struct { struct tas_s tas; t value; }
  34. #define boolean_v(b) { {t_boolean<<r_type_shift}, (ushort)(b) }
  35. #define integer_v(i) { {t_integer<<r_type_shift}, (long)(i) }
  36. #define null_v() { {t_null<<r_type_shift} }
  37. #define real_v(v) { {t_real<<r_type_shift}, (float)(v) }
  38.  
  39. /* Define other initialization structures. */
  40. typedef struct {
  41.     byte encx, charx;
  42. } charindex;
  43.  
  44. /*
  45.  * We represent mostly-string arrays by byte strings.  Each element
  46.  * starts with length bytes.  If the first length byte is not 255,
  47.  * it and the following byte define a big-endian length of a string or name.
  48.  * If the first two bytes are (255,255), this element is null.
  49.  * Otherwise, the initial 255 is followed by a 2-byte big-endian length
  50.  * of a string that must be scanned as a token.
  51.  */
  52. typedef const char *cfont_string_array;
  53.  
  54. /* Support routines in iccfont.c */
  55. typedef struct {
  56.     const charindex *enc_keys;    /* keys from encoding vectors */
  57.     uint num_enc_keys;
  58.     uint num_str_keys;
  59.     uint extra_slots;        /* (need extra for fonts) */
  60.     uint dict_attrs;        /* protection for dictionary */
  61.     uint value_attrs;        /* protection for values */
  62.     /* (only used for string dicts) */
  63. } cfont_dict_keys;
  64.  
  65. /*
  66.  * We pass a procedure vector to the font initialization routine
  67.  * to avoid having externs, which compromise sharability.
  68.  */
  69. typedef struct cfont_procs_s {
  70.     int (*ref_dict_create) (P5(i_ctx_t *, ref *, const cfont_dict_keys *,
  71.                    cfont_string_array, const ref *));
  72.     int (*string_dict_create) (P5(i_ctx_t *, ref *, const cfont_dict_keys *,
  73.                   cfont_string_array,
  74.                   cfont_string_array));
  75.     int (*num_dict_create) (P6(i_ctx_t *, ref *, const cfont_dict_keys *,
  76.                    cfont_string_array, const ref *,
  77.                    const char *));
  78.     int (*name_array_create) (P4(i_ctx_t *, ref *, cfont_string_array, int));
  79.     int (*string_array_create) (P5(i_ctx_t *, ref *, cfont_string_array,
  80.                    int /*size */ , uint /*protection */ ));
  81.     int (*scalar_array_create) (P5(i_ctx_t *, ref *, const ref *,
  82.                    int /*size */ , uint /*protection */ ));
  83.     int (*name_create) (P3(i_ctx_t *, ref *, const char *));
  84.     int (*ref_from_string) (P4(i_ctx_t *, ref *, const char *, uint));
  85. } cfont_procs;
  86.  
  87. /*
  88.  * In order to make it possible for third parties to compile fonts (into
  89.  * a shared library, on systems that support such things), we define
  90.  * a tiny procedural interface for getting access to the compiled font table.
  91.  */
  92. #define ccfont_proc(proc)\
  93.   int proc(P3(i_ctx_t *, const cfont_procs *, ref *))
  94. typedef ccfont_proc((*ccfont_fproc));
  95.  
  96. /*
  97.  * There should be some consts in the *** below, but a number of
  98.  * C compilers don't handle const properly in such situations.
  99.  */
  100. extern int ccfont_fprocs(P2(int *, const ccfont_fproc **));
  101.  
  102. #define ccfont_version 19    /* for checking against libraries */
  103.  
  104. #endif /* ccfont_INCLUDED */
  105.